package com.vhall.component.entity.account.enums;

import com.vhall.component.entity.dictionary.enums.BaseEnum;

/**
 * RoleNameEnum- 用户在直播间的角色枚举
 * 1:主持人,2:观众,3:助理,4:嘉宾
 *
 * @author xing.wang
 * @date 2023/9/15
 */
public enum RoleNameEnum implements BaseEnum {
    HOST(1, "主持人","host"),
    AUDIENCE(2, "观众","audience"),
    GUEST(4, "嘉宾","guest"),
    ASSISTANT(3, "助理","assistant");
    private final Integer value;
    private final String name;
    private final String desc;

    RoleNameEnum(Integer value, String name,String desc) {
        this.value = value;
        this.name = name;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return value;
    }

    @Override
    public String getName() {
        return name;
    }
    /**
     * 通过 value 获取 name
     * @param value
     * @return
     */
    public static String getNameByValue(Integer value) {
        for (RoleNameEnum e : RoleNameEnum.values()) {
            if (e.getValue().equals(value)) {
                return e.getName();
            }
        }
        return null;
    }
}
